<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>系统用户管理--layui后台管理模板</title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="format-detection" content="telephone=no"/>
    <link rel="stylesheet" href="/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/css/font_eolqem241z66flxr.css" media="all"/>
    <link rel="stylesheet" href="/css/user.css" media="all"/>
</head>
<body class="childrenBody">
<form class="layui-form" id="pageForm" name="pageForm" action="/admin_list" method="post">
<!--    <blockquote class="layui-elem-quote news_search">-->
<!--        <div class="layui-inline">-->
<!--            <div class="layui-input-inline">-->
<!--                <input type="text" name="userName" th:value="${userName}" placeholder="请输入关键字"-->
<!--                       class="layui-input search_input"/>-->
<!--            </div>-->
<!--            <button class="layui-btn search_btn" type="submit">查询</button>-->
<!--        </div>-->
<!--        <div class="layui-inline">-->
<!--            <a class="layui-btn layui-btn-normal newsAdd_btn">添加用户</a>-->
<!--        </div>-->
<!--    </blockquote>-->
    <div class="layui-form news_list">
        <table class="layui-table">
            <colgroup>
                <col width="5%"/>
                <col width="10%"/>
                <col width="12%"/>
                <col width="7%"/>
                <col width="7%"/>
                <col width="15%"/>
                <col width="7%"/>
                <col width="20%"/>
            </colgroup>
            <thead>
            <tr>
                <!--<th><input type="checkbox" name="" title=""/></th>-->
                <th>序号</th>
                <th>用户名</th>
                <th>联系方式</th>
                <th>姓名</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody class="users_content">
            <tr th:each="var,iterStat: ${pagerHelper.records}">
                <td th:text="${iterStat.count}"></td>
                <td th:text="${var.userName}"></td>
                <td th:text="${var.linkTel}"></td>
                <td th:text="${var.name}"></td>
                <td th:if="${var.state==0}">停用</td>
                <td th:if="${var.state==1}">启用</td>
                <td th:if="${var.state==''}"></td>
                <td>
                    <a class="layui-btn layui-btn-xs" th:if="${var.id != 'b496894b89754a848e9b74ff66a05d44'}"
                       th:href="|/admin_todetail/${var.id}|">
                        <i class="layui-icon">&#xe60a;</i>
                    </a>
                    <a class="layui-btn layui-btn-xs layui-btn-normal"
                       th:if="${var.id != 'b496894b89754a848e9b74ff66a05d44'}" th:href="|/admin_toEdit/${var.id}|">
                        <i class="layui-icon">&#xe642;</i>
                    </a>
                    <a class="layui-btn layui-btn-xs layui-btn-danger"
                       th:if="${var.id != 'b496894b89754a848e9b74ff66a05d44'}"
                       th:href="|javascript:admin_delete('${var.id}')|">
                        <i class="layui-icon">&#xe640;</i>
                    </a>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
    <div class="layui-table-page">
        <div class="layui-table-page">
            <div id="layui-table-page1">
                <div class="layui-box layui-laypage layui-laypage-default" id="layui-laypage-2">
                    <span class="layui-laypage-count" th:text="'共'+${pagerHelper.totalCount}+'条'"></span>
                    <span class="layui-laypage-skip">
						<input type="number" name="pageNumber" id="pageNumber" th:value="${pagerHelper.pageNumber}"
                               class="layui-input"/></span>
                    <span class="layui-laypage-limits">
						<a class="layui-btn toPage">跳转</a>
						<a class="layui-btn toPageOne">首页</a>
						<a class="layui-btn previousPage"><i class="layui-icon"></i></a>
						<a class="layui-btn nextPage"><i class="layui-icon"></i></a>
						<a class="layui-btn toPageLast">尾页</a>
					</span>
                    <span class="layui-laypage-count" th:text="'共'+${pagerHelper.pageCount}+'页'"></span>
                    <span class="layui-laypage-limits">
						<select lay-ignore="" id="pageSize" name="pageSize">
							<option value="7" th:selected="${pagerHelper.pageSize==7?'selected':'false'}">7 条/页</option>
							<option value="20"
                                    th:selected="${pagerHelper.pageSize==20?'selected':'false'}">20 条/页</option>
							<option value="30"
                                    th:selected="${pagerHelper.pageSize==30?'selected':'false'}">30 条/页</option>
							<option value="40"
                                    th:selected="${pagerHelper.pageSize==40?'selected':'false'}">40 条/页</option>
							<option value="50"
                                    th:selected="${pagerHelper.pageSize==50?'selected':'false'}">50 条/页</option>
							<option value="60"
                                    th:selected="${pagerHelper.pageSize==60?'selected':'false'}">60 条/页</option>
							<option value="70"
                                    th:selected="${pagerHelper.pageSize==70?'selected':'false'}">70 条/页</option>
							<option value="80"
                                    th:selected="${pagerHelper.pageSize==80?'selected':'false'}">80 条/页</option>
							<option value="90"
                                    th:selected="${pagerHelper.pageSize==90?'selected':'false'}">90 条/页</option>
							<option value="100"
                                    th:selected="${pagerHelper.pageSize==100?'selected':'false'}">100 条/页</option>
						</select>
					</span>
                </div>
            </div>
        </div>
        <input type="hidden" id="count" name="count" th:value="${pagerHelper.totalCount}"/>
        <input type="hidden" id="size" name="size" th:value="${pagerHelper.pageCount}"/>
    </div>
</form>
<script type="text/javascript" src="/layui/layui.js"></script>
<script type="text/javascript" src="/js/admin/adminList.js"></script>
<script type="text/javascript" src="/js/jquery-1.7.2.js"></script>
<script type="text/javascript">

    /**
     * 删除用户
     * @param id
     */
    function admin_delete(id) {
        //询问框
        layer.confirm('确定删除该条数据嘛?', {
            btn: ['确定', '取消'] //按钮
        }, function () {
            $.getJSON("/admin_delete/" + id, function (result) {
                if (result.code == 200) {
                    layer.msg('删除成功', {
                        time: 2000, //2s后自动关闭
                    }, function () {
                        location.href = "/admin_list";
                    });
                } else {
                    layer.msg('删除失败', {
                        time: 2000, //2s后自动关闭
                    });
                }
            });
        });
    }

</script>
</body>
</html>